import 'package:flutter/material.dart';
import 'package:pd_application/routes.dart';

// ignore: must_be_immutable
class PageContent extends StatelessWidget {
  final String name;
  const PageContent({super.key, required this.name});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(
          '当前页面：$name',
          style: const TextStyle(
            color: Colors.white,
          ),
        ),
        centerTitle: true,
        backgroundColor: Colors.blue,
      ),
      body: ListView(children: [
        TextButton(
          onPressed: () {
            Navigator.pushNamed(context, Routes.HOME);
          },
          child: Text(Routes.HOME),
        ),
        TextButton(
          onPressed: () {
            Navigator.pushNamed(context, Routes.LOGIN);
          },
          child: Text(Routes.LOGIN),
        ),
        TextButton(
          onPressed: () {
            Navigator.pushNamed(context, Routes.REGISTER);
          },
          child: Text(Routes.REGISTER),
        ),
        TextButton(
          onPressed: () {
            Navigator.pushNamed(context, '/aaaa');
          },
          child: const Text('不存在的路由'),
        ),
        TextButton(
          onPressed: () {
            Navigator.pushNamed(context, Routes.ORDER, arguments: '订单列表');
          },
          child: const Text('带参数路由'),
        ),
      ]),
    );
  }
}
